#include "custompushbutton.h"
#include "ui_custompushbutton.h"

CustomPushButton::CustomPushButton(QWidget *parent) :
    QPushButton(parent),
    ui(new Ui::CustomPushButton)
{
    ui->setupUi(this);
    setFocusPolicy(Qt::StrongFocus);
}

CustomPushButton::~CustomPushButton()
{
    delete ui;
}

void CustomPushButton::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
        // 单独的Enter或Return键，触发发送按键的逻辑
        emit click();
    }
    else
    {
        // 对于其他按键，调用基类的keyPressEvent
        QPushButton::keyPressEvent(event);
    }
}
